#!/bin/sh
#
# Copyright (C) 2014-2015 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

# This file is meant for maintainers of GNU gettext.  It prepends a
# release-announcement entry to all ChangeLog files.
#
#   Usage: update-changelog VERSION USER EMAIL

test $# == 3 || { echo "Usage: $0 VERSION USER EMAIL" 1>&2; exit 1; }

if test ! -d gettext-runtime || test ! -d gettext-tools; then
  echo "$0: run in the top-level directory" 1>&2
  exit 1
fi

ver=$1
user=$2
email=$3

for file in `find . -name "ChangeLog"`; do
  test $file = "./gnulib/ChangeLog" \
    || test $file = "./gettext-tools/examples/hello-c++-kde/admin/ChangeLog" \
    || { { date=`date -u +%Y-%m-%d`;
           cat <<EOF
$date  $user  <$email>

	* gettext $ver released.

EOF
           cat $file; } > $file.tmp && mv $file.tmp $file; }
done
